<?php switch ($type):
    case 'input':
        ?><input type="text" id="<?php echo $formSlug ?>-<?php echo $slug ?>" name="<?php echo $slug ?>" value="<?php echo htmlspecialchars($value) ?>" <?php foreach($options AS $key=>$option): echo $key; ?>="<?php echo $option; ?>" <?php endforeach; ?> /><?php
        break;

    case 'textarea':
        ?><textarea id="<?php echo $formSlug ?>-<?php echo $slug ?>" name="<?php echo $slug ?>" <?php foreach($options AS $key=>$option): echo $key; ?>="<?php echo $option; ?>" <?php endforeach; ?>><?php echo htmlspecialchars($value) ?></textarea><?php
        break;

    case 'editor':
        ?><textarea class="tinymce" id="<?php echo $formSlug ?>-<?php echo $slug ?>" name="<?php echo $slug ?>"><?php echo htmlspecialchars($value) ?></textarea><?php
        break;

    case 'colorpicker': 
        ?><input type="text" id="<?php echo $formSlug ?>-<?php echo $slug ?>" name="<?php echo $slug ?>" value="<?php echo htmlspecialchars($value) ?>" class="color-picker" /><?php
        break;

    case 'password':
        ?><input type="password" id="<?php echo $formSlug ?>-<?php echo $slug ?>" name="<?php echo $slug ?>" value="<?php echo htmlspecialchars($value) ?>" <?php foreach($options AS $key=>$option): echo $key; ?>="<?php echo $option; ?>" <?php endforeach; ?> /><?php
        break;

    case 'checkbox':
        ?><input type="checkbox" id="<?php echo $formSlug ?>-<?php echo $slug ?>" name="<?php echo $slug ?>" <?php if ($value): ?>checked="checked"<?php endif; ?> title="<?php echo $helper ?>" <?php foreach($options AS $key=>$option): echo $key; ?>="<?php echo $option; ?>" <?php endforeach; ?> /><?php
        break;
    default:

    case 'select':
        ?><select id="<?php echo $formSlug ?>-<?php echo $slug ?>" name="<?php echo $slug ?>" <?php foreach($options AS $key=>$option): echo $key; ?>="<?php echo $option; ?>" <?php endforeach; ?>><?php
        foreach ($possibleValues AS $key=>$possibleValue): ?>
            <option value="<?php echo $key ?>" <?php  if ($key == $value): ?>selected="selected"<?php endif; ?>><?php echo $possibleValue ?></option>
        <?php endforeach; 
        ?></select><?php
        break;

    case 'multi':
        ?><select multiple="true" id="<?php echo $formSlug ?>-<?php echo $slug ?>" name="<?php echo $slug ?>[]" <?php foreach($options AS $key=>$option): echo $key; ?>="<?php echo $option; ?>" <?php endforeach; ?>><?php
        foreach ($possibleValues AS $key=>$possibleValue): ?>
            <option value="<?php echo $key ?>" <?php if (in_array($key, $value)): ?>selected="selected"<?php endif; ?>><?php echo $possibleValue ?></option>
        <?php endforeach;
        ?></select><?php
        break;

    case 'hidden':
        ?><input type="hidden" name="<?php echo $slug ?>" value="<?php echo htmlspecialchars($value) ?>" <?php foreach($options AS $key=>$option): echo $key; ?>="<?php echo $option; ?>" <?php endforeach; ?> /><?php
        break;

    case 'text':
        ?><p <?php foreach($options AS $key=>$option): echo $key; ?>="<?php echo $option; ?>" <?php endforeach; ?>><?php echo $name ?></p>
        <input type="hidden" name="<?php echo $slug ?>" value="<?php echo htmlspecialchars($value) ?>" />
        <?php
        break;


    case 'inputimage':
        if ( !empty($value) ): ?>
            <a href="" style="float:left;position:relative;top:-8px;margin-right:5px;">
                <img style="border:1px solid black;max-height:40px;max-width:40px;" src="<?php echo $value ?>" title="Image actuelle" alt="Image actuelle" />
            </a>
        <?php endif; ?>
        <input type="file" class="file" name="<?php echo $slug ?>" id="<?php echo $formSlug ?>-<?php echo $slug ?>" />
        <?php
        break;
        
    default:

endswitch; ?>